/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jogopoo.Interface;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/**
 *Classe da Janela do Menu
 * @author acer_5542
 */
public class Menu extends JFrame implements ActionListener {

    private MenuPanel menu;
    private JPanel botao;
    private JButton iniciar;
    private JButton highScore;
    private JButton sair;

    public Menu() throws InterruptedException {

        Container contentPane = this.getContentPane();
        
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setBounds(10, 10, 800, 598);
        this.setTitle("Space Invaders");
        this.setResizable(false);


        menu = new MenuPanel();
        botao = new JPanel();
        contentPane.add(menu);
        menu.setLayout(new BorderLayout());
        menu.add(botao, BorderLayout.SOUTH);

        botao.setOpaque(false);

        iniciar = new JButton("INICIAR");
        highScore = new JButton("HIGHSCORE");
        sair = new JButton("SAIR");

        botao.add(iniciar, BorderLayout.NORTH);
        botao.add(highScore, BorderLayout.CENTER);
        botao.add(sair, BorderLayout.SOUTH);

        iniciar.addActionListener(this);
        highScore.addActionListener(this);
        sair.addActionListener(this);


    }

    public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();

        if (source == iniciar) {
            try {
                Janela jp = new Janela();
                jp.setVisible(true);

                this.dispose();
            } catch (InterruptedException ex) {
                Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else if (source == highScore) {
            Ranking rk = new Ranking();
            rk.setVisible(true);
            this.dispose();
        } else if (source == sair) {
            System.exit(0);
        }
    }
}
